/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bddfirstproject.exception;

import bddfirstproject.PropsUtils;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author epulapp
 */
public class OracleExceptionManager {
    
    private static OracleExceptionManager instance;
    protected Properties oracleMessagesError;
    
    public OracleExceptionManager() {
        try {
            oracleMessagesError = PropsUtils.load("config/oracle_error.properties");
        } catch(IOException e1) {
            System.err.println("Erreur, configuration de la base erronée - " + e1);
        }
    }
    
    public static OracleExceptionManager getInstance() {
        if(instance == null) {
            instance = new OracleExceptionManager();
        }
        return instance;
    }
    
    public String getMessage(String codeError) {
        return oracleMessagesError.getProperty("error_" + codeError);
    }
    
    public String getMessage(int codeError) {
        return this.getMessage(String.valueOf(codeError));
    }
    
}
